SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.DnnProduct_DeleteUsersOnline
	@TimeWindow int	
AS
BEGIN
    DECLARE @dt datetime
	SET @dt = DATEADD(MINUTE, -@TimeWindow, GETDATE())

	DELETE FROM dbo.DnnProduct_AnonymousUsers WHERE LastActiveDate < @dt

	DELETE FROM dbo.DnnProduct_UsersOnline WHERE LastActiveDate < @dt
END
GO
